package com.xxx.hhh.demo.demo3;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IentAddressDemo {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress byName = InetAddress.getByName("DESKTOP-VDVLNFI");
        String hostName = byName.getHostName();
        System.out.println("计算机名为:" + byName);
        String hostAddress = byName.getHostAddress();
        System.out.println(hostAddress);
    }
}
